<?php
// inc.mysql.php
// creates connection for mysql database
class mysli {
	private $conn;

	// construction creates the actual connection!
	public function __construct() {
		$this->conn = mysql_connect(MYSQL_ADDRESS, MYSQL_USER, MYSQL_PASS) or
			die('MySQL connection failed!!');
		
		mysql_select_db(MYSQL_DB, $this->conn) or
			die('MySQL DB select failed!!');
	}
	
	// when destroying disconnecting!
	public function __destruct() {
		mysql_close($this->conn);
	}
	
	// query function
	public function q($q) {
		$query = mysql_query($q, $this->conn) or die('MySQL query failed!!');
		return $query;
	}
}

?>